/* model */
import {
  BaseSelectUserMarkTypeEnum, 
  BaseSelectUserTab
} from '@src/component/common/BaseSelectUser/model'
/* util */
import { isFalse } from '@src/util/type'

/** 
 * @description 是否是第一个tab
*/
function isFirstTab<T>(value: T[], index: number) {
  return index == 0
}

/** 
 * @description 是否不为第一个tab
*/
function isNotFirstTab<T>(value: T[], index: number) {
  return isFalse(isFirstTab(value, index))
}

/** 
 * @description 是否为 部门 tab选项
*/
function isDepartmentTab(tab: BaseSelectUserTab): boolean {
  return tab?.name == BaseSelectUserMarkTypeEnum.Tag
}

/** 
 * @description 是否为 角色 tab选项
*/
function isRoleTab(tab: BaseSelectUserTab): boolean {
  return tab?.name == BaseSelectUserMarkTypeEnum.Role
}

/** 
 * @description 是否为 服务商 tab选项
*/
function isServiceProviderTab(tab: BaseSelectUserTab): boolean {
  return tab?.name == BaseSelectUserMarkTypeEnum.ServiceProvider
}

/** 
 * @description 是否为 部门 tab选项
*/
function isDepartmentTabByTabType(type: string): boolean {
  return type === BaseSelectUserMarkTypeEnum.Tag
}

/** 
 * @description 是否为 角色 tab选项
*/
function isRoleTabByTabType(type: string): boolean {
  return type === BaseSelectUserMarkTypeEnum.Role
}

/** 
 * @description 是否为 服务商 tab选项
*/
function isServiceProviderTabByTabType(type: string): boolean {
  return type === BaseSelectUserMarkTypeEnum.ServiceProvider
}

/**
 * @description 是否为 项目组 tab选项
 */
function isProjectTeamTabByTabType(type: string): boolean {
  return type === BaseSelectUserMarkTypeEnum.ProjectTeam
}

/** 
 * @description 是否为 动态获取 tab选项
*/
function isDynamicTabByTabType(type: string): boolean {
  return type === BaseSelectUserMarkTypeEnum.Dynamic || type === BaseSelectUserMarkTypeEnum.Da
}

export {
  isFirstTab,
  isNotFirstTab,
  isDepartmentTab,
  isRoleTab,
  isServiceProviderTab,
  isDepartmentTabByTabType,
  isRoleTabByTabType,
  isServiceProviderTabByTabType,
  isProjectTeamTabByTabType,
  isDynamicTabByTabType
}